﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;
namespace HFWebApp.FAQs
{
    public partial class asklist1 : BagePages
    {
        public string StyleStr1 { get; set; }
        public string StyleStr2 { get; set; }
        public string StyleStr3 { get; set; }
        public string StyleStr4 { get; set; }
        public string StyleStr5 { get; set; }
        public string PageStr { get; set; }
        /// <summary>
        /// bt_bj_27  ,bt_bj_28
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int PageSize = 24;
                int PageNumber = 1;
                if (this.GetQuery("Page") != "")
                {
                    PageNumber = int.Parse(this.GetQuery("Page"));
                }
                int total;
                string strWhere = "";
                string OrderByKey = "ID";
                #region 条件搜索
                string provinceid = this.GetQuery("provinceid");
                if (provinceid != "")
                {
                    if (provinceid != "0")
                    {
                        strWhere = "ProvinceID=" + provinceid;
                    }
                }

                string smallclassid = this.GetQuery("smallclassid");
                if (smallclassid != "")
                {
                    if (smallclassid != "0")
                    {
                        if (strWhere == "")
                        {
                            strWhere = "SmallClassID=" + smallclassid.ToString();
                        }
                        else {
                            strWhere = strWhere + " and SmallClassID=" + smallclassid.ToString();
                        }
                    }
                }
                #endregion

                #region 样式
                string StyleType = this.GetQuery("styletypeid");
                StyleStr1 = "bt_bj_28";
                StyleStr2 = "bt_bj_28";
                StyleStr3 = "bt_bj_28";
                StyleStr4 = "bt_bj_28";
                StyleStr5 = "bt_bj_28";
                switch (StyleType)
                {
                    case "":
                    case "1":
                        StyleStr1 = "bt_bj_27";
                        break;
                    case "2":
                        StyleStr2 = "bt_bj_27";
                        OrderByKey = "Points";
                        break;
                    case "3":
                        StyleStr3 = "bt_bj_27";
                        if (strWhere == "")
                        {
                            strWhere = "AnswerCount = 0";
                        }
                        else {
                            strWhere = strWhere + " and AnswerCount = 0";
                        }
                        break;
                    case "4":
                        StyleStr4 = "bt_bj_27";
                        if (strWhere == "")
                        {
                            strWhere = "StatusID = 0";
                        }
                        else
                        {
                            strWhere = strWhere + " and StatusID = 0";
                        }
                        break;
                    case "5":
                        StyleStr5 = "bt_bj_27";
                        if (strWhere == "")
                        {
                            strWhere = "StatusID = 1";
                        }
                        else
                        {
                            strWhere = strWhere + " and StatusID = 1";
                        }
                        break;
                }
                #endregion

                Repeater1.DataSource = AskController.getController().getAskList(PageSize, PageNumber, strWhere, out total, OrderByKey);
                Repeater1.DataBind();
                PageStr = LLL.Pager.TrunPageHtmlCode_Web(PageSize, PageNumber, total, "");
            }
        }
    }
}